package com.web.main.entity.param;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * @create 2020-11-21 20:16
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
@ApiModel(value = "admin条件查询")
public class AdminQuery implements Serializable {
    private static final long serialVersionUID = -3564613046260975789L;

    @ApiModelProperty(value = "账号（联系电话）")
    @Pattern(regexp = "^[1]([3-9])[0-9]{9}$", message = "请输入有效的手机号码")
    private String username;

    @ApiModelProperty(value = "姓名")
    @Size(min = 2, max = 4, message = "姓名长度应该在{min}~{max}之间")
    private String name;

    @ApiModelProperty(value = "查询开始时间", example = "2019-01-01 10:10:10")
    @DateTimeFormat(pattern = "^[1-9]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\\s+(20|21|22|23|[0-1]\\d):[0-5]\\d:[0-5]\\d$")
    private String begin;  //注意，这里使用的是String类型，前端传过来的数据无需进行类型转换

    @ApiModelProperty(value = "查询结束时间", example = "2020-12-01 10:10:10")
    @DateTimeFormat(pattern = "^[1-9]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])\\s+(20|21|22|23|[0-1]\\d):[0-5]\\d:[0-5]\\d$")
    private String end;

}
